﻿// Decompiled with JetBrains decompiler
// Type: MCM.LightInject.ServiceRegistryExtensions
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Diagnostics.CodeAnalysis;

#nullable disable
namespace MCM.LightInject
{
  [ExcludeFromCodeCoverage]
  internal static class ServiceRegistryExtensions
  {
    public static IServiceRegistry Register(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory)
    {
      return serviceRegistry.Register(serviceType, factory, string.Empty, (ILifetime) null);
    }

    public static IServiceRegistry Register(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      ILifetime lifetime)
    {
      return serviceRegistry.Register(serviceType, factory, string.Empty, lifetime);
    }

    public static IServiceRegistry Register(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, factory, serviceName, (ILifetime) null);
    }

    public static IServiceRegistry Register(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      string serviceName,
      ILifetime lifetime)
    {
      ServiceRegistration serviceRegistration1 = new ServiceRegistration();
      serviceRegistration1.FactoryExpression = (Delegate) factory;
      serviceRegistration1.ServiceType = serviceType;
      serviceRegistration1.ServiceName = serviceName;
      serviceRegistration1.Lifetime = lifetime;
      ServiceRegistration serviceRegistration2 = serviceRegistration1;
      return serviceRegistry.Register(serviceRegistration2);
    }

    public static IServiceRegistry RegisterSingleton(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory)
    {
      return serviceRegistry.RegisterSingleton(serviceType, factory, string.Empty);
    }

    public static IServiceRegistry RegisterSingleton(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, factory, serviceName, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterScoped(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory)
    {
      return serviceRegistry.RegisterScoped(serviceType, factory, string.Empty);
    }

    public static IServiceRegistry RegisterScoped(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, factory, serviceName, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterTransient(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory)
    {
      return serviceRegistry.RegisterTransient(serviceType, factory, string.Empty);
    }

    public static IServiceRegistry RegisterTransient(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Func<IServiceFactory, object> factory,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, factory, serviceName);
    }

    public static IServiceRegistry RegisterSingleton<TService, TImplementation>(
      this IServiceRegistry serviceRegistry)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>((ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton<TService>(this IServiceRegistry serviceRegistry)
    {
      return serviceRegistry.Register<TService>((ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton<TService, TImplementation>(
      this IServiceRegistry serviceRegistry,
      string serviceName)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>(serviceName, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType)
    {
      return serviceRegistry.Register(serviceType, implementingType, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton(
      this IServiceRegistry serviceRegistry,
      Type serviceType)
    {
      return serviceRegistry.Register(serviceType, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, implementingType, serviceName, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory)
    {
      return serviceRegistry.Register<TService>(factory, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterSingleton<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory,
      string serviceName)
    {
      return serviceRegistry.Register<TService>(factory, serviceName, (ILifetime) new PerContainerLifetime());
    }

    public static IServiceRegistry RegisterScoped<TService, TImplementation>(
      this IServiceRegistry serviceRegistry)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>((ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped<TService>(this IServiceRegistry serviceRegistry)
    {
      return serviceRegistry.Register<TService>((ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped<TService, TImplementation>(
      this IServiceRegistry serviceRegistry,
      string serviceName)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>(serviceName, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType)
    {
      return serviceRegistry.Register(serviceType, implementingType, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped(
      this IServiceRegistry serviceRegistry,
      Type serviceType)
    {
      return serviceRegistry.Register(serviceType, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, implementingType, serviceName, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory)
    {
      return serviceRegistry.Register<TService>(factory, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterScoped<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory,
      string serviceName)
    {
      return serviceRegistry.Register<TService>(factory, serviceName, (ILifetime) new PerScopeLifetime());
    }

    public static IServiceRegistry RegisterTransient<TService, TImplementation>(
      this IServiceRegistry serviceRegistry)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>();
    }

    public static IServiceRegistry RegisterTransient<TService>(this IServiceRegistry serviceRegistry)
    {
      return serviceRegistry.Register<TService>();
    }

    public static IServiceRegistry RegisterTransient<TService, TImplementation>(
      this IServiceRegistry serviceRegistry,
      string serviceName)
      where TImplementation : TService
    {
      return serviceRegistry.Register<TService, TImplementation>(serviceName);
    }

    public static IServiceRegistry RegisterTransient(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType)
    {
      return serviceRegistry.Register(serviceType, implementingType);
    }

    public static IServiceRegistry RegisterTransient(
      this IServiceRegistry serviceRegistry,
      Type serviceType)
    {
      return serviceRegistry.Register(serviceType);
    }

    public static IServiceRegistry RegisterTransient(
      this IServiceRegistry serviceRegistry,
      Type serviceType,
      Type implementingType,
      string serviceName)
    {
      return serviceRegistry.Register(serviceType, implementingType, serviceName);
    }

    public static IServiceRegistry RegisterTransient<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory)
    {
      return serviceRegistry.Register<TService>(factory);
    }

    public static IServiceRegistry RegisterTransient<TService>(
      this IServiceRegistry serviceRegistry,
      Func<IServiceFactory, TService> factory,
      string serviceName)
    {
      return serviceRegistry.Register<TService>(factory, serviceName);
    }

    public static IServiceRegistry Override<TService, TImplementation>(
      this IServiceRegistry serviceRegistry)
      where TImplementation : TService
    {
      return serviceRegistry.Override((Func<ServiceRegistration, bool>) (sr => sr.ServiceType == typeof (TService)), (Func<IServiceFactory, ServiceRegistration, ServiceRegistration>) ((serviceFactory, registration) =>
      {
        registration.FactoryExpression = (Delegate) null;
        registration.ImplementingType = typeof (TImplementation);
        return registration;
      }));
    }

    public static IServiceRegistry Override<TService, TImplementation>(
      this IServiceRegistry serviceRegistry,
      ILifetime lifetime)
      where TImplementation : TService
    {
      return serviceRegistry.Override((Func<ServiceRegistration, bool>) (sr => sr.ServiceType == typeof (TService)), (Func<IServiceFactory, ServiceRegistration, ServiceRegistration>) ((serviceFactory, registration) =>
      {
        registration.FactoryExpression = (Delegate) null;
        registration.ImplementingType = typeof (TImplementation);
        registration.Lifetime = lifetime;
        return registration;
      }));
    }

    public static IServiceRegistry Initialize<TService>(
      this IServiceRegistry serviceRegistry,
      Action<IServiceFactory, TService> processor)
    {
      return serviceRegistry.Initialize((Func<ServiceRegistration, bool>) (sr => sr.ServiceType == typeof (TService)), (Action<IServiceFactory, object>) ((factory, instance) => processor(factory, (TService) instance)));
    }
  }
}
